<%
layout("layout.html",{title:'资金记录', first: '用户', second: '资金记录', menu: '用户'}){
%>
<div class="dataTables_wrapper form-inline dt-bootstrap">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <h3 class="box-title">全部列表</h3>
                </div>
                <div class="col-xs-12">
                	<form role="form" id="record_form" action="${ctxPath}/admin/moneyRecords">
                		<input type="hidden" id="userId" name="userId" value="${userId}">
                		<input type="hidden" id="message" name="message" value="${message}">
                		<label>总资金: </label>
                		<select name="messageAll" onchange="getRecords(this.value)">
                		
                			<option value="">全部</option>
                			<option value="总资金增加" <% if(message == '总资金增加') print('selected="selected"'); %> >总资金增加</option>
                			<option value="总资金减少" <% if(message == '总资金减少') print('selected="selected"'); %>  >总资金减少</option>
                			<option value="充值"  <% if(message == '充值') print('selected="selected"'); %> >总资金充值</option>
                		</select>
                		<label>可用资金: </label>
                		<select name="messageAble" onchange="getRecords(this.value)">
                		
                			<option value="">全部</option>
                			<option value="可用资金到账" <% if(message == '可用资金到账') print('selected="selected"'); %> >可用资金到账</option>
                			<option value="可用资金减少" <% if(message == '可用资金减少') print('selected="selected"'); %>  >总资金减少</option>
                			<option value="油卡充值"  <% if(message == '油卡充值') print('selected="selected"'); %> >总资金充值</option>
                		</select>
                	</form>
                </div>
                <div class="box-body">
                    <table class="table">
                        <thead>
                        <tr>
                            <th>id</th>
                            <th>金额</th>
                            <th>时间</th>
                            <th>类别</th>
                        </tr>
                        </thead>
                        <tbody>
                        <% for (record in records) { %>
                        <tr>
                            <td>${record.id}</td>
                            <td>${parseLong(record.money / 100)}</td>
                            <td>${record.createTime,dateFormat="yy-MM-dd HH:mm"}</td>
                            <td>
                                <% switch (record.type) {
                                case 'All': print('总金额');break;
                                case 'Able': print('可用金额');break;
                                }
                                %>
                            </td>
                        </tr>
                        <% } %>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-5">
            <div class="dataTables_info" id="example2_info" role="status" aria-live="polite">第${paging.page}页 共${paging.all}页 ${paging.count}条数据
            </div>
        </div>
        <div class="col-sm-7">
            <div class="dataTables_paginate paging_simple_numbers">
                <ul class="pagination">
                    <li class="paginate_button previous <% if (paging.page == 1) print('disabled'); %>">
                        <a href="${ctxPath}/admin/moneyRecords?userId=${userId}&page=${paging.page - 1}&message=${message}" aria-controls="example2" data-dt-idx="0" tabindex="0">上一页</a>
                    </li>
                    <% for (thisPage in paging.shows) { %>
                    <li class="paginate_button <% if (thisPage == paging.page) print('active'); %>">
                    	<a href="${ctxPath}/admin/moneyRecords?userId=${userId}&page=${thisPage}&message=${message}" aria-controls="example2" data-dt-idx="1" tabindex="0">${thisPage}</a>
                    </li>
                    <% } %>
                    <li class="paginate_button next <% if (paging.page == paging.all) print('disabled'); %>" id="example2_next">
                        <a href="${ctxPath}/admin/moneyRecords?userId=${userId}&page=${paging.page + 1}&message=${message}" aria-controls="example2" data-dt-idx="7" tabindex="0">下一页</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
<script>
   
   $(document).ready(function(){
        $('li.disabled a').attr('href', 'javascript:');
    });
    
    // 查询知道类型记录
    function getRecords(value){
    	
    	$("#message").val(value);
    	
    	document.getElementById("record_form").submit();
    }
    
</script>
<% } %>